/**
 * Created with IntelliJ IDEA.
 * User: duoba
 * Date: 16/2/25
 * Time: 上午11:45
 * To change this template use File | Settings | File Templates.
 */

package com.cake21.uitest.Page;

import java.util.List;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.cake21.uitest.System.Core.Page;

public class CakePage extends Page {
    /*页面元素*/
    @FindBy(id = "op_product_zoom")
    private WebElement imageURL;
    @FindBy(css = ".spec-attr")
    private List<WebElement> specList;
    @FindBy(id = "IDproductbuynow")
    private WebElement buyBtn;
    @FindBy(id = "IDproductaddtocart")
    private WebElement cartBtn;

    /*构造函数*/
    public CakePage() {

    }

    /*点击立即购买*/
    public CheckOutPage goCheckOut() {
        if(buyBtn.isDisplayed()) {
            buyBtn.click();
            return new CheckOutPage(driver);
        }
        else {
            return null;
        }
    }
}
